<?php $__env->startSection("content"); ?>
<body class="login-bg">

<div class="login">
    <div class="message">x-admin2.0-管理登录</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form" >
        <input name="name" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
        <hr class="hr15">
        <input name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20" >
    </form>
</div>

<script>
    $(function  () {
        layui.use('form', function(){
            var form = layui.form;
            form.on('submit(login)', function(data){
                $.ajax({
                    url:"<?php echo e(url('/admin/login')); ?>",
                    type: 'post',
                    data:data.field,
                    dataType: 'json',
                    success: function (data) {
                        if(data.error ==1){
                            layer.msg(data.info, function(){
                            });
                        }else if(data.error ==0) {
                            layer.alert(data.info, {icon: 6}, function () {
                                window.location.href = "<?php echo e(url('/admin/home')); ?>";
                            });
                        }
                    },
                    fail: function (err) {
                        console.log(err)
                    },
                    statusCode: {
                        422: function(data) {
                            layer.msg('账号或密码错误', function(){
                            });
                        }
                    }
                })

                return false;
            });
        });
    })


</script>

</body>
<!-- 底部结束 -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make("admin.layout.layout", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>